package com.leyou.order.config;



import com.github.wxpay.sdk.WXPay;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 初始化支付工具对象
 */
@Configuration
public class PayConfig {

    @Bean
    public WXPay wxPay(PayProperties payProps) throws Exception {
       com.github.wxpay.sdk.PayConfig payConfig = new com.github.wxpay.sdk.PayConfig();

        payConfig.setAppID(payProps.getAppId());
        payConfig.setMchID(payProps.getMchId());
        payConfig.setKey(payProps.getKey());

        return new WXPay(payConfig);
    }
}
